home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Netware Super Library
/
Netware Super Library.iso
/
pgm_tool
/
vap
/
vsetup.asm
< prev
next >
Wrap
Assembly Source File
|
1988-05-03
|
8KB
|
421 lines
;*****************************************************************************
;*
;* Program Name: VAP_Setup_Module
;*
;* Filename: vsetup.asm
;*
;* Version: 1.0
;*
;* Programmers: Bryan Sparks
;*
;* Comments: This is the startup and setup code for VAPs.
;*
;*****************************************************************************
name VAPSetUpAndStartModule
DGROUP GROUP _DATA
PGROUP GROUP _TEXT
assume cs:PGROUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; TEXT definitions
;; Define header, ESR routines, Handler routines,
;; and ProcessStart procedures
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_TEXT segment public 'CODE'
;VAP definitions
public NetWareShellServices, ProcessControlServices
public ConsoleControlServices, IPXSPXServices
;IPX/SPX Definitions
public _ReceiveESRHandler, _SendESRHandler
;SAP Definitions
public _SAPWaitESRHandler, _SAPAdvertiseESRHandler
;Handler front-ends
extrn _ConsoleHandler: near, _DownHandler: near
;IPX/SPX ESR Externals
;;;; extrn _ReceiveESR: near, _SendESR: near
extrn _SAPWaitESR: near, _SAPAdvertiseESR: near
;VAP Header
Signature db 'NWProc'
NetWareShellServices dd ?
ProcessControlServices dd ?
ConsoleControlServices dd ?
IPXSPXServices dd ?
VAPConsoleHandler dd ConsoleHandlerCALL
VAPDownHandler dd DownHandlerCALL
VAPConsoleOrDownDataSegment dw DGroup
VAPConnectionRequestFlag dw 1 ;No connection
VAPNameString db 'Name String', 64-($-VAPNameString) dup(0)
VAPConsoleKeyWordCount dw 2
VAPKeyword1 db 'FIRST', 16-($-VAPKeyword1) dup(0)
VAPKeyword2 db 'SECOND', 16-($-VAPKeyword2) dup(0)
VAPSignOnMessage db 'Sign-on message.', 0
db 500-($-VAPSignOnMessage) dup(0)
VAPStart proc near
mov ax, DGroup
mov di, 1 ;change segment to data (read/write)
call dword ptr cs:ProcessControlServices
cli
mov ax, DGroup
mov ds, ax
mov es, ax
mov ss, ax
mov ax, OFFSET DGroup:MainStackEnd
mov sp, ax
sti
call _MAIN
VAPStart endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Spawned Process front-ends
;; These set the process up by assigning the segment registers
;; and assigning a stack to the process.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The following lines will change as YOUR VAP dictates.
;; You will need to have you own names, etc.
;;
;; Note that you will also need to change the KEYWORDs and the
;; Stack names at the bottom of this file.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Process definitions
public _FirstProcessStart
public _SecondProcessStart
extrn _Main: near
extrn _FirstProcess: near
extrn _SecondProcess: near
_FirstProcessStart proc near
cli
mov ax, DGroup
mov ds, ax
mov es, ax
mov ss, ax
mov ax, OFFSET DGroup:FirstStackEnd
mov sp, ax
sti
call _FirstProcess
_FirstProcessStart endp
_SecondProcessStart proc near
cli
mov ax, DGroup
mov ds, ax
mov es, ax
mov ss, ax
mov ax, OFFSET DGroup:SecondStackEnd
mov sp, ax
sti
call _SecondProcess
_SecondProcessStart endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Handler front-ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
assume ds: DGroup
ConsoleHandlerCALL proc far
mov _Keyword, ax
call _ConsoleHandler
ret
ConsoleHandlerCALL endp
DownHandlerCALL proc far
call _DownHandler
ret
DownHandlerCALL endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Event Service Routine front-ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_ReceiveESRHandler proc far
mov ax, DGroup
mov ds, ax
push es
push si
;;; call _ReceiveESR
add sp, 4
ret
_ReceiveESRHandler endp
_SendESRHandler proc far
mov ax, DGroup
mov ds, ax
push es
push si
;;; call _SendESR
add sp, 4
ret
_SendESRHandler endp
_SAPWaitESRHandler proc far
mov ax, DGroup
mov ds, ax
push es
push si
call _SAPWaitESR
add sp, 4
ret
_SAPWaitESRHandler endp
_SAPAdvertiseESRHandler proc far
mov ax, DGroup
mov ds, ax
push es
push si
call _SAPAdvertiseESR
add sp, 4
ret
_SAPAdvertiseESRHandler endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Misc Procedures
;; MSC stack check fake-out
;; IPX Functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
public __CHKSTK
public _IPXOpenSocket
public _IPXCloseSocket
public _IPXGetInternetworkAddress
public _IPXSendPacket
public _IPXListenForPacket
public _IPXScheduleIPXEvent
public _IPXCancelEvent
public _IPXGetLocalTarget
public _IPXRelinquishControl
public _IntSwap
__CHKSTK proc near
pop cx ; get return offset
sub sp,ax ; allocate stack space
jmp cx ; return to cx
__CHKSTK endp
;Parameters:
; On Entry: Pointer to socket to open
; Socket Longevity
; On Exit: Error codes in AX
_IPXOpenSocket proc near
push bp
mov bp, sp
mov bx, [bp+4]
mov dx, [bx]
mov ax, [bp+6]
call dword ptr cs: IPXSPXServices
pop bp
ret
_IPXOpenSocket endp
;Parameters:
; On Entry: Socket Number
; On Exit: nothing
_IPXCloseSocket proc near
push bp
mov bp, sp
mov dx, [bp+4]
call dword ptr cs: IPXSPXServices
pop bp
ret
_IPXCloseSocket endp
;Parameters:
; On Entry: 10 byte buffer
; On Exit: 10 byte buffer will contain address
_IPXGetInternetworkAddress proc near
push bp
mov bp,sp
mov ax, DGroup
mov es, ax
mov bx, [bp+4]
mov si, bx
mov bx, 09h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXGetInternetworkAddress endp
;Parameters
; On Entry: Pointer to ECB
_IPXSendPacket proc near
push bp
mov bp, sp
mov ax, DGroup
mov es, ax
mov bx, [bp+4]
mov si, bx
mov bx, 03h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXSendPacket endp
;Parameters
; On Entry: Pointer to ECB
_IPXListenForPacket proc near
push bp
mov bp, sp
mov ax, DGroup
mov es, ax
mov bx, [bp+4]
mov si, bx
mov bx, 04h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXListenForPacket endp
_IPXScheduleIPXEvent proc near
push bp
mov bp, sp
mov ax, DGroup
mov es, ax
mov bx, [bp+6]
mov si, bx
mov ax, [bp+4]
mov bx, 05h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXScheduleIPXEvent endp
;Parameters
; On Entry: Pointer to ECB
_IPXCancelEvent proc near
push bp
mov bp, sp
mov ax, DGroup
mov es, ax
mov bx, [bp+4]
mov si, bx
mov bx, 06h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXCancelEvent endp
;Parameters:
; On Entry: Pointer to 12 byte address
; Pointer to 6 byte empty buffer
_IPXGetLocalTarget proc near
push bp
mov bp,sp
mov ax, DGroup
mov es, ax
mov bx, [bp+4]
mov si, bx
mov bx, [bp+6]
mov di, bx
mov bx, 02h
call dword ptr cs: IPXSPXServices
push ds
pop es
pop bp
ret
_IPXGetLocalTarget endp
;Parameters:
; On Entry: nothing
; On Exit: nothing
_IPXRelinquishControl proc near
mov bx, 0Ah
call dword ptr cs: IPXSPXServices
ret
_IPXRelinquishControl endp
;Parameters:
; On Entry: Parameter to swap
; On Exit: Returns swapped integer in AX
_IntSwap proc near
push bp
mov bp, sp
mov ax, [bp+4]
xchg ah, al
pop bp
ret
_IntSwap endp
_TEXT ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Data definitions
;; Define all stacks for all processes and also define keyword variable
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_DATA SEGMENT word public 'DATA'
assume ds:DGROUP
;Stacks
dw 2000 dup (0)
MainStackEnd label word
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Here are the stacks appropiate for each process.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dw 2000 dup (0)
FirstStackEnd label word
dw 2000 dup (0)
SecondStackEnd label word
;Keyword that will be used in C program
public _Keyword
_Keyword dw 0
_DATA ENDS
end VAPStart